//
// Created by shaowenhan on 2020/3/7.
//

#include "ConfigurableEventListener.h"
#include "ReadLRPInstance.h"
#if defined(LRP)

class TestReadLRPInstance: public testing::Test{
public:
    string instanceName = "../../TEST/Instance.json";
    ReadLRPInstance readInstance;
    Instance instance;
    TestReadLRPInstance(): readInstance(instanceName), instance(readInstance.obtainInstance()){}
};
TEST_F(TestReadLRPInstance, InstanceType)
{
    ASSERT_EQ("schneider", instance.instanceType);
}
TEST_F(TestReadLRPInstance, VehicleCapcity)
{
    ASSERT_EQ(70, instance.vehicleCap);
}
TEST_F(TestReadLRPInstance, VehicleCost)
{
    ASSERT_EQ(1000, instance.vehicleCost);
}
TEST_F(TestReadLRPInstance, DepotCount)
{
    ASSERT_EQ(1, instance.depotCount);
}
TEST_F(TestReadLRPInstance, CustomerCount)
{
    ASSERT_EQ(2, instance.cusCount);
}
TEST_F(TestReadLRPInstance, Distance)
{
    vector<vector<DisType>> expectedDistance = {
            {0, 3081, 3570},
            {3081, 0, 1487},
            {3570, 1487, 0}
    };
    ASSERT_EQ(expectedDistance, instance.distances);
}
TEST_F(TestReadLRPInstance, NodesDemand)
{
    vector<int> expectedDemands = {770, 18, 17};
    ASSERT_EQ(expectedDemands, instance.nodeDemands);
}
TEST_F(TestReadLRPInstance, DepotCosts)
{
    vector<int> expectedDepotCosts = {42};
    ASSERT_EQ(expectedDepotCosts, instance.depotCosts);
}
TEST_F(TestReadLRPInstance, InstanceName)
{
    ASSERT_EQ("2-1-1c", instance.instanceName);
}
#endif
GTEST_API_ int main(int argc, char** argv) {
    testing::InitGoogleTest(&argc, argv);
    initialGTest();
    return RUN_ALL_TESTS();
}